package com.vincent.redissondemo.service;

import org.redisson.api.RBucket;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author vincent
 * @DATE 2018/10/3
 * @Description
 */
@Service
public class RedissonService {
    @Autowired
    private RedissonClient redisson;

    public void set(String key, String value) {
        RBucket<String> bucket = redisson.getBucket(key);
        bucket.set(value);
    }

    public String get(String key) {
        RBucket<String> bucket = redisson.getBucket(key);
        return bucket.get();
    }
}
